#ifndef TERRAIN_H
#define TERRAIN_H

#include "brique.h"
#include "tableau.h"

const int LARGEUR=20;
const int HAUTEUR=14;


const int terrain1[HAUTEUR][LARGEUR]=
{
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,21,12,00,00,00,00,11,11,12,00,00,00,00,00,00,00},
	{00,00,14,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
};//terrain1 est une map!!
const int terrain2[HAUTEUR][LARGEUR]=
{
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,10,00,00,00,00,00,00,00,10,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
};//terrain2 est une map!!
const int terrain3[HAUTEUR][LARGEUR]=
{
	{00,00,00,00,13,00,00,00,20,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,10,00,00,00,20,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,12,00,00,00,20,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,10,00,00,00,10,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,11,00,00,00,10,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
};//terrain3 est une map!! test resistance et option des briques

const int terrain4[HAUTEUR][LARGEUR]=
{
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,00},
	{00,20,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,20,00},
	{00,20,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,20,00},
	{00,20,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,20,00},
	{00,20,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,20,00},
	{00,20,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,20,00},
	{00,20,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,20,00},
	{00,20,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,20,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
};//terrain4 est une map!! test rebondissement paroi

const int terrain5[HAUTEUR][LARGEUR]=
{
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
	{00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00},
};//terrain5 est une map!! test terrain vide


struct Sterrain
{
	int tailleX;
	int tailleY;
	int niveau;
	Brique* brq[100][100];
	TableauOp* opt;
};
typedef struct Sterrain Terrain;

void initTer(Terrain* t);
Terrain* creerTer(const int map[HAUTEUR][LARGEUR]);
Brique* getBriqueTer(const Terrain* t, const int x, const int y);
int getDimxTer(const Terrain* t);
int getDimyTer(const Terrain* t);
int positionValideSdl(const Terrain* t,const int x,const int y);
int positionValideTer(const Terrain* t,const int x,const int y);
int estVideTer(Terrain* t);
TableauOp* getOptionTerrain(const Terrain* t);
void libereTer(Terrain* t);
void enclencheOptionTer(Terrain* t,Brique* br);
void touteOptionTombeTer(Terrain* t);


#endif
